<?php
//后台相关
$api = app('Dingo\Api\Routing\Router');
$array = [
    'middleware' => [
        'api.throttle',
//        'serializer:array',
        'bindings'
    ],
    'limit' => 60,
    'expires' => 1
];
$api->version('v1',$array, function ($api) {       //多个版本['v1','v2']      可加中间件

    $api->group(['prefix'=>'admin'],function ($api){


        //需要登录的路由
        $api ->group(['middleware'=>['api.auth','permission']],function ($api){
            //
            $api->resource('category', \App\Http\Controllers\Admin\CategoryController::class,[
                'expect'=> 'destroy'
            ]);
            //
//            $api->resource('comments', \App\Http\Controllers\Admin\CommentsController::class,[
//                'only'=> 'index'
//            ]); //暂时不用
            $api->resource('users', \App\Http\Controllers\Admin\UserController::class,[
                'except'=> 'destroy'
            ]);
            $api->post('users/{user}/lock',[\App\Http\Controllers\Admin\UserController::class,'lcok'])->name('users.lock');
             //上热门
            $api->post('/{write}/on',[\App\Http\Controllers\Web\WriteController::class,'on'])->name('write.on');
            /*
             * 后台被举报的用户
             * */
            $api->resource('report',\App\Http\Controllers\Admin\ReportController::class);
            //意见反馈获得
            $api->get('feedbacklook',[\App\Http\Controllers\Admin\FeedBackController::class,'back_look'])->name('feedback.get');
            //意见反馈处理
            $api->post('feedbackdown/{feedback}',[\App\Http\Controllers\Admin\FeedBackController::class,'back_down'])->name('feedback.down');
            //意见反馈已阅
            $api->post('feedbacklooked/{feedback}',[\App\Http\Controllers\Admin\FeedBackController::class,'back_looked'])->name('feedback.looked');


        });
    });

});
